#pragma once
#include <string>

#include <grpcpp/grpcpp.h>

#include "stack_chat_db.h"
#include "db_server.grpc.pb.h"

using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;


class DatabaseServiceImpl final : public dbserver::Database::Service {
public:
	stack_chat_db db;
public:
	grpc::Status UserSearchByID(grpc::ServerContext* context,
		const dbserver::SearchByIDRequest* request,
		dbserver::SearchByIDResponse* response) override;

	grpc::Status UserGetNameByID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::GetStringResponse* response) override;

	grpc::Status UserGetPasswordByID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::GetStringResponse* response) override;

	grpc::Status UserUpdateNameByID(grpc::ServerContext* context,
		const dbserver::UpdateRequest* request,
		dbserver::UpdateResponse* response) override;

	grpc::Status UserUpdatePasswordByID(grpc::ServerContext* context,
		const dbserver::UpdateRequest* request,
		dbserver::UpdateResponse* response) override;

	grpc::Status UserDeleteByID(grpc::ServerContext* context,
		const dbserver::DeleteByIDRequest* request,
		dbserver::DeleteResponse* response) override;

	grpc::Status UserInsert(grpc::ServerContext* context,
		const dbserver::InsertRequest* request,
		dbserver::InsertResponse* response) override;

	grpc::Status UserInfoSearchByID(grpc::ServerContext* context,
		const dbserver::SearchByIDRequest* request,
		dbserver::SearchByIDResponse* response) override;


	grpc::Status UserInfoInsert(grpc::ServerContext* context,
		const dbserver::UserInfoInsertRequest* request,
		dbserver::InsertResponse* response) override;

	grpc::Status UserInfoDeleteByID(grpc::ServerContext* context,
		const dbserver::DeleteByIDRequest* request,
		dbserver::DeleteResponse* response) override;

	grpc::Status UserInfoUpdateByID(grpc::ServerContext* context,
		const dbserver::UserInfoInsertRequest* request,
		dbserver::UpdateResponse* response) override;

	grpc::Status UserInfoGetInfoByID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::UserInfoResponse* response) override;

	grpc::Status ServerLogSearchByID(grpc::ServerContext* context,
		const dbserver::SearchByIDRequest* request,
		dbserver::SearchByIDResponse* response) override;

	grpc::Status ServerLogInsert(grpc::ServerContext* context,
		const dbserver::ServerLogInsertRequest* request,
		dbserver::InsertResponse* response) override;

	grpc::Status ServerLogDeleteByID(grpc::ServerContext* context,
		const dbserver::DeleteByIDRequest* request,
		dbserver::DeleteResponse* response) override;

	grpc::Status ServerLogUpdateByID(grpc::ServerContext* context,
		const dbserver::ServerLogInsertRequest* request,
		dbserver::UpdateResponse* response) override;

	grpc::Status ServerLogGetLogByID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::ServerLogResponse* response) override;

	grpc::Status MessageLogSearchByID(grpc::ServerContext* context,
		const dbserver::SearchByIDRequest* request,
		dbserver::SearchByIDResponse* response) override;

	grpc::Status MessageLogGetMessageByUserID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::GetStringResponse* response) override;

	grpc::Status MessageLogInsert(grpc::ServerContext* context,
		const dbserver::MessageLogInsertRequest* request,
		dbserver::InsertResponse* response) override;

	grpc::Status FriendTableSearchByID(grpc::ServerContext* context,
		const dbserver::SearchByIDRequest* request,
		dbserver::SearchByIDResponse* response) override;

	grpc::Status FriendTableGetFriendsByUserID(grpc::ServerContext* context,
		const dbserver::GetByIDRequest* request,
		dbserver::GetStringResponse* response) override;

	grpc::Status FriendTableIsFriend(grpc::ServerContext* context,
		const dbserver::IsFriendRequest* request,
		dbserver::IsFriendResponse* response) override;

	grpc::Status  FriendTableDeleteByUserID(grpc::ServerContext* context,
		const dbserver::DeleteByUserIDRequest* request,
		dbserver::DeleteResponse* response) override;

	grpc::Status  FriendTableInsert(grpc::ServerContext* context,
		const dbserver::FriendTableInsertRequest* request,
		dbserver::InsertResponse* response) override;
};